﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Configuration;



namespace LaneLpnr.Common
{
    public class ConfigHelper
    {
        public static string connectionString = "";

        public static string GetConnectionStringConfig(string connectionName)
        {
            try
            {
                connectionString = "";
                //指定config 文件读取
                if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionName].ConnectionString))
                {
                    return connectionString;
                }
                else
                {
                    connectionString = ConfigurationManager.ConnectionStrings[connectionName].ConnectionString;
                    if (connectionString != string.Empty && connectionString != null)
                    {
                        return connectionString;
                    }
                    else
                    {
                        return connectionString = "test";
                    }
                }
                //return connectionString;
            }
            catch (Exception ex)
            {
                Common.WriteLog.WriteLogstatic(connectionName + " 获取配置文件异常退出：" + ex.ToString(), "Com");
                return null;
            }
        }


    }
}
